import http from './http.js';
export function getOpenId(code) {
	return uni.request({
		method: 'GET',
		url: 'https://api.weixin.qq.com/sns/jscode2session?appid=wxf7b648b8085a8785&secret=d2cc9f81dc8d1f263f9971c6878345a7&grant_type=authorization_code&js_code=' +
			code
	})
}

export function getUserInfoByOpenId(openid) {
	return http({
		url: `/user/${openid}`,
		method: 'GET'
	})
}


export function saveUserInfo(param) {
	return http({
		method: 'POST',
		url: '/user',
		data: param
	})
}

export function savePoi(param) {
	return http({
		method: 'POST',
		url: '/poi',
		data: param
	})
}
export function saveBikeInvitation(param) {
	return http({
		method: 'POST',
		url: '/invitation',
		data: param
	})
}

export function queryNewBikeInvitations(param) {
	return http({
		method: 'GET',
		url: '/invitation/page',
		params:param
	})
}

export function getInvitionDetail(id){
	return http({
		method:'GET',
		url:`/invitation/${id}`
	})
}
